import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/viewmodel/meter_reading/submit_meter_reading_view_model.dart';

class SubmitMeterReadingPage extends BaseStatefulMvvmWidget{
  final String? roomId;
  final String? lastNumber;

  SubmitMeterReadingPage({this.roomId, this.lastNumber});


  @override
  State<StatefulWidget> createState() => _SubmitMeterReadingState();


}

class _SubmitMeterReadingState extends BaseMvvmState<SubmitMeterReadingViewModel,SubmitMeterReadingPage>{
  @override
  Widget buildLoadingContentView() {
    return viewModel.contentView();
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return loadingContentWidget;
  }

  @override
  SubmitMeterReadingViewModel createViewModel() {
    return SubmitMeterReadingViewModel(context,roomId: widget.roomId,lastNumber: widget.lastNumber);
  }

  @override
  void onRetryClick() {
    // TODO: implement onRetryClick
  }

}

showMeterReadingSheet(BuildContext context,{String? roomId,String? lastNumber}){
  showModalBottomSheet(context: context, builder: (context){
    return SafeArea(child: SubmitMeterReadingPage(roomId:
      roomId,lastNumber: lastNumber,)).addToContainer(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.vertical(top: 15.radius)
      )
    );
  },backgroundColor: Colors.transparent);
}

